import { request } from '@/utils'

// 分组列表
export function deptList() {
  return request({
    url: `projectTaskExe/selectlistgroup`,
    method: 'get',
  })
}

// 分组列表,包括管理层
export function deptAllList() {
  return request({
    url: `projectTaskExe/selectlistgroupall`,
    method: 'get',
  })
}

// 模块树
export function moduleTree(params) {
  return request({
    url: `projectTaskModule/selectprojectTaskModuleVos`,
    method: 'get',
    params,
  })
}

// 任务列表
export function list(data) {
  return request({
    url: `projectTaskModule/selectList`,
    method: 'post',
    data,
  })
}

// 详情任务
export function infoModule(id) {
  return request({
    url: `projectTaskModule/${id}`,
    method: 'get',
  })
}

// 新增任务
export function addModule(data) {
  return request({
    url: `projectTaskModule/add`,
    method: 'post',
    data,
  })
}

// 修改任务
export function editModule(data) {
  return request({
    url: `projectTaskModule/update`,
    method: 'put',
    data,
  })
}

// 删除任务
export function delModule(id) {
  return request({
    url: `projectTaskModule/${id}`,
    method: 'delete',
  })
}

// 获取任务执行人
export function infoPerson(id) {
  return request({
    url: `projectTaskExe/${id}`,
    method: 'get',
  })
}

// 修改任务执行人
export function editPerson(data) {
  return request({
    url: `projectTaskExe/update`,
    method: 'put',
    data,
  })
}

// 删除任务执行人
export function delPerson(id) {
  return request({
    url: `projectTaskExe/${id}`,
    method: 'delete',
  })
}

// 获取选择模块
export function moduleList(params) {
  return request({
    url: `projectTaskModule/selectmodule`,
    method: 'get',
    params,
  })
}

// 获取研发范围
export function deptScope(params) {
  return request({
    url: `projectTaskExe/selectlist`,
    method: 'get',
    params,
  })
}

// 获取评论接口
export function commentList(params) {
  return request({
    url: `/projectTaskComment/selectpage`,
    method: 'get',
    params,
  })
}

// 添加评论接口
export function commentAdd(data) {
  return request({
    url: `/projectTaskComment/add`,
    method: 'post',
    data,
  })
}

// 获取评论接口
export function historyList(params) {
  return request({
    url: `/projectTaskHistory/selectpage`,
    method: 'get',
    params,
  })
}

// 当前登录者是否可以查看详情
export function canView(params) {
  return request({
    url: `projectTaskModule/jump`,
    method: 'post',
    params,
  })
}

// 获取列设置
export function getCol() {
  return request({
    url: `wideColumnSettings/column`,
    method: 'post',
  }).then(({ data: { columnSetting, id } }) => ({ columnSetting: JSON.parse(columnSetting), id }))
}

// 获取列设置
export function setCol({ columnSetting, id }) {
  return request({
    url: `wideColumnSettings/update`,
    method: 'post',
    data: { columnSetting: JSON.stringify(columnSetting), id },
  })
}

// 设置取消标记
export function setMark(data) {
  return request({
    url: `projectTaskDuration`,
    method: 'post',
    data,
  })
}

export function cupList(params) {
  return request({
    url: `projectTaskCup/select`,
    method: 'get',
    params,
  })
}

export function cupAdd(data) {
  return request({
    url: `projectTaskCup/add`,
    method: 'post',
    data,
  })
}

export function cupEdit(data) {
  return request({
    url: `projectTaskCup/update`,
    method: 'put',
    data,
  })
}

export function cupDel(id) {
  return request({
    url: `projectTaskCup/${id}`,
    method: 'delete',
  })
}

export function sortModule(params) {
  return request({
    url: `projectTaskModule/updateEntitysort`,
    method: 'post',
    params,
  })
}

export function getLock(projectId) {
  return request({
    url: `projectTask/${projectId}`,
    method: 'get',
  })
}

export function setLock(data) {
  return request({
    url: `projectTask`,
    method: 'put',
    data,
  })
}

export function customWorkdayList() {
  return request({
    url: `signWeekend`,
    method: 'get',
  })
}

export function addCustomWorkday(data) {
  return request({
    url: `signWeekend`,
    method: 'post',
    data,
  })
}

export function delCustomWorkday(params) {
  return request({
    url: `signWeekend/del`,
    method: 'delete',
    params,
  })
}
